package se.webbzon.oschi01.nbt;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import se.webbzon.oschi01.singleton.Singleton;

public class IntTagFactory extends AbstractTagFactory<Integer> implements Singleton {

	private IntTagFactory() {
		super(Tags.TAG_INT, "TAG_Int");
	}

	@Override public IntTag readTag(String tagName, DataInputStream is) throws IOException {
		return new IntTag(this, tagName,is.readInt());
	}

	@Override public void writeTag(Tag<Integer> tag, DataOutputStream dos) throws IOException {
		dos.writeInt(tag.getValue());
	}

	@Override public Tag<Integer> createTag(String tagName) {
		return new IntTag(this, tagName, 0);
	}

}
